//160 easy
function getNode(headA, headB) {
  let temp = headA;
  const sets = new Set();
  while (temp != null) {
    sets.add(temp);
    temp = temp.next;
  }
  temp = headB;
  while (temp != null) {
    if (sets.has(temp)) {
      return temp;
    }
    temp = temp.next;
  }
}
console.log();
